import request from '@/utils/request'

// 添加用户
export function addUserApi(params = {}) {
  return request.post('/system/sysUser', params)
}

// 修改用户
export function modifyUserApi(params = {}) {
  return request.put('/system/sysUser', params)
}

// 查询用户
export function getUserListApi(params = {}) {
  return request.get('/system/sysUser/page', { params })
}

// 删除用户
export function deleteUserApi(params) {
  return request.delete(`/system/sysUser/${params.id}`)
}

// 重置用户密码
export function resetUserPasswordApi(params) {
  return request.put(`/system/sysUser/reset/${params.id}`)
}

// 批量删除
export function deleteUsersApi(params) {
  return request.delete('/system/sysUser/delete', {
    data: params
  })
}
// 用户修改密码
export function modifyPasswordApi(params) {
  return request.put('/system/sysUser/updatePwd', params)
}

// 导出数据的接口
export function exportUserApi(params = {}) {
  return request.post('/system/sysUser/export', params, { responseType: 'blob' })
}

// 保存个人信息
export function setUserInfo(params) {
  return request.put('/system/sysUser', params)
}

// 保存个人信息
export function getUserInfoByNameApi(params) {
  return request.get('/system/sysUser/getByUserName', { params })
}
